package com.desanonymerUtilisateurs;

import static com.desanonymerUtilisateurs.ConnectDatabase.con;

import java.awt.List;
import java.sql.ResultSet;
import java.sql.SQLException;


public class UserList {
	
	private static List liste;
	public static ConnectDatabase connect = new ConnectDatabase();

	public UserList()
	{
		//this.proprietaire=prop;
		this.liste = new List();	
	}
	
	 public  static  void recupusers()
	    {
	        	ConnectDatabase.connectDatabase();
	            
	        	ResultSet result = ConnectDatabase.doRequest("SELECT userName FROM user");
	            System.out.println("Liste recuperee");
	            String resultat;
	            //this.liste=result;
	            
	            try {
					while(result.next())
					{
						resultat = result.getString("userName");
						System.out.println("resultat : " + resultat);
						liste.add(resultat);
						System.out.println("liste : " + liste.getItem(0));
					}
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

	    }
	 public List recupliste()
	 {
		 return (this.liste);
	 }
	
}
